<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:c="http://java.sun.com/jsp/jstl/core"
   xmlns:p="http://primefaces.org/ui">
   
<ui:composition template="/admin.xhtml">
   <ui:define name="page.title">
      #{msg['product.register.title']}
   </ui:define>
   
   <f:metadata name="metadata">
      <f:viewParam name="searchType" value="#{product.searchType}" />
      <f:viewParam name="product" value="#{product.current}" converter="productConverter" />
   </f:metadata>

   <ui:define name="admin.content">
      <p:spacer height="10" />
      <h:form id="crud" prependId="false">
         <p:panel header="#{msg['product.register.title']}"
            toggleable="true" toggleSpeed="100"
            toggleTitle="#{msg['city.register.title']}">
            <p:messages />
            <h:panelGrid columns="3">
               <h:outputLabel
                  value="#{msg['product.register.label.code']}" />
               <p:spacer width="10" />
               <p:inputText id="code" value="#{product.current.code}"
                  disabled="true" />

               <h:outputLabel
                  value="#{msg['product.register.label.name']}" />
               <p:spacer width="10" />
               <p:inputText id="name" value="#{product.current.name}" />

               <h:outputLabel
                  value="#{msg['product.register.label.model']}" />
               <p:spacer width="10" />
               <p:inputText id="model" value="#{product.current.model}" />

               <h:outputLabel
                  value="#{msg['product.register.label.stock']}" />
               <p:spacer width="10" />
               <p:inputText id="stock" value="#{product.current.stock}" />

               <h:outputLabel
                  value="#{msg['product.register.label.minstock']}" />
               <p:spacer width="10" />
               <p:inputText id="minstock"
                  value="#{product.current.minStock}" />

               <h:outputLabel
                  value="#{msg['product.register.label.price']}" />
               <p:spacer width="10" />
               <p:inputText id="price" value="#{product.current.price}" />
            </h:panelGrid>
            <p:spacer width="15" />
            <br />
            <p:commandButton id="save" value="#{msg['crud.save']}"
               async="true" update="crud" action="#{product.save}" />
            <p:commandButton id="cancel" value="#{msg['crud.cancel']}"
               async="true" update="crud" immediate="true" />
         </p:panel>
         <p:spacer height="15" />
         <p:panel id="list" toggleable="true" toggleSpeed="100"
            toggleTitle="#{msg['product.list.title']}"
            header="#{msg['product.list.title']}">

            <ui:include src="/product-list.xhtml" />
         </p:panel>
      </h:form>
   </ui:define>
</ui:composition>
</html>
